#!/usr/bin/env python
#coding=utf-8
#File: piple.py
from subprocess import *
p1 = Popen(["ls"], stdout = PIPE)
p2 = Popen(["grep", ".py"], stdin = p1.stdout, stdout = PIPE)
output = p2.communicate()[0]
#print p2.stdout.read()
print output